package com.coolbi.onsupai.core.biz.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.coolbi.onsupai.core.biz.SettleCategoryBiz;
import com.coolbi.onsupai.core.dao.SettleCategoryDao;
import com.coolbi.onsupai.core.entity.SettleCategory;
import com.coolbi.onsupai.core.exception.ServiceException;

public class SettleCategoryBizImpl implements SettleCategoryBiz {

	@Autowired
	private SettleCategoryDao settleCategoryDao;
	
	@Override
	public SettleCategory save(SettleCategory obj) {
		try {
			settleCategoryDao.save(obj);
		} catch (Exception e) {
			throw new ServiceException("添加结算方式发生错误！", e);
		}
		return obj;
	}

	@Override
	public void delete(long id) {
		try {
			settleCategoryDao.delete(id);
		} catch (Exception e) {
			throw new ServiceException("删除结算方式发生错误！", e);
		}
	}

	@Override
	public void update(SettleCategory obj) {
		try {
			settleCategoryDao.update(obj);
		} catch (Exception e) {
			throw new ServiceException("修改结算方式发生错误！", e);
		}
	}

	@Override
	public SettleCategory get(long id) {
		return settleCategoryDao.get(id);
	}

	@Override
	public List<SettleCategory> list() {
		return settleCategoryDao.list();
	}

	@Override
	public List<SettleCategory> listByPage(int offset, int limit) {
		return settleCategoryDao.listByPage(offset, limit);
	}

	@Override
	public List<SettleCategory> find(Map<String, Object> parameter) {
		return settleCategoryDao.find(parameter);
	}

	@Override
	public List<SettleCategory> findByPage(Map<String, Object> parameter,
			int offset, int limit) {
		return settleCategoryDao.findByPage(parameter, offset, limit);
	}

	@Override
	public List<SettleCategory> search(Map<String, Object> parameter,
			int offset, int limit) {
		return settleCategoryDao.search(parameter, offset, limit);
	}

	@Override
	public int count() {
		return settleCategoryDao.count();
	}

	@Override
	public int countByKeyWord(Map<String, Object> parameter) {
		return settleCategoryDao.countByKeyWord(parameter);
	}

	@Override
	public int count(Map<String, Object> parameter) {
		return settleCategoryDao.count(parameter);
	}

	public void setSettleCategoryDao(SettleCategoryDao settleCategoryDao) {
		this.settleCategoryDao = settleCategoryDao;
	}

}
